#define _CRT_SECURE_NO_WARNINGS
#include "SListNode.h"

void test1()
{
	SLTNode* node1 = (SLTNode*)malloc(sizeof(SLTNode));
	SLTNode* node2 = (SLTNode*)malloc(sizeof(SLTNode));
	SLTNode* node3 = (SLTNode*)malloc(sizeof(SLTNode));
	SLTNode* node4 = (SLTNode*)malloc(sizeof(SLTNode));

	if (node1 == NULL)
	{
		perror("node1");
		exit(1);
	}
	if (node2 == NULL)
	{
		perror("node1");
		exit(1);
	}
	if (node3 == NULL)
	{
		perror("node1");
		exit(1);
	}
	if (node4 == NULL)
	{
		perror("node1");
		exit(1);
	}

	node1->data = 1;
	node2->data = 2;
	node3->data = 3;
	node4->data = 4;

	SLTNode* plist = node1;
	node1->next = node2;
	node2->next = node3;
	node3->next = node4;
	node4->next = NULL;

	SLTPrint(plist);
}

//void test2()
//{
//	SLTNode* plist = NULL;
//	SLTPushBack(&plist, 1);
//	SLTPushBack(&plist, 2);
//	SLTPushBack(&plist, 3);
//	SLTPushBack(&plist, 4);
//	SLTPrint(plist);
//	//SLTPushFront(&plist, 1);
//	//SLTPushFront(&plist, 2);
//	//SLTPushFront(&plist, 3);
//	//SLTPushFront(&plist, 4);
//	SLTPopFront(&plist);
//	SLTPrint(plist);
//	SLTPopFront(&plist);
//	SLTPrint(plist);
//	SLTPopFront(&plist);
//	SLTPrint(plist);
//	SLTPopFront(&plist);
//	SLTPrint(plist);
//}

void test3()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTDestroy(&plist);
}

int main()
{
	//test1();
	//test2();
	test3();
	return 0;
}
